package org.looop.studio.bean.desc.impl;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

import org.looop.studio.bean.desc.ValueDesc;
import org.looop.studio.bean.factory.BeanFactory;

public class MapValueDesc implements ValueDesc {
	private Map<String, ValueDesc> valueMap;
	
	public Map<String, ValueDesc> getValueMap() {
		return valueMap;
	}

	public void setValueMap(Map<String, ValueDesc> valueMap) {
		this.valueMap = valueMap;
	}

	@Override
	public Object getValue(BeanFactory beanFactory)
			throws IllegalArgumentException, SecurityException,
			InstantiationException, IllegalAccessException,
			ClassNotFoundException, InvocationTargetException,
			NoSuchMethodException {
		Map<String, Object> map = new HashMap<String, Object>();
		for(Map.Entry<String, ValueDesc> entry : valueMap.entrySet()){
			map.put(entry.getKey(), entry.getValue().getValue(beanFactory));
		}
		return map;
	}

}
